#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 8005;

int n, m;
int a[N], b[N], c[N];
bool cmp(int i, int j) {  // 大于
  if (a[i] != a[j])
    return a[i] > a[j];
  else
    return i > j;
}
void insert_sort() {
  rep(i, 1, n) {
    int k = b[i];
    int j = i - 1;
    for (; j >= 1 && cmp(b[j], k); j--) {
      b[j + 1] = b[j];
    }
    b[j + 1] = k;
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, n) b[i] = i;
  insert_sort();
  rep(i, 1, n) c[b[i]] = i;
  while (m--) {
    int op, x, v;
    cin >> op;
    if (op == 1) {
      cin >> x >> v;
      a[x] = v;
      insert_sort();
      rep(i, 1, n) c[b[i]] = i;
    } else {
      cin >> x;
      cout << c[x] << endl;
    }
  }
  return 0;
}